//
//  HLHomeRecommendRequest.m
//  YueYue
//
//  Created by hulu001 on 2023/6/2.
//

#import "HLHomeRecommendRequest.h"

@implementation HLHomeRecommendRequest
{
    NSString *_code;
}

- (id)initWithType:(HLHomeRecommendType)type
{
    self = [super init];
    
    if (self) {
        switch (type) {
            case HLHomeRecommendTypeHome:
                _code = @"1";
                break;
            case HLHomeRecommendTypeMessage:
                _code = @"2";
                break;
        }
    }
    
    return self;
}


- (NSString *)requestUrl
{
    return  @"/user/recommend/listVideo";
}

- (YTKRequestMethod)requestMethod
{
    return YTKRequestMethodGET;
}

- (id)requestArgument
{
    return @{@"displayPosition":_code};
}


- (NSArray <HLHomeListModel *> *)recommendList
{
    NSArray *lists = @[];
    NSArray *data = [self.result valueForKey:@"data"];
    if (![data isKindOfClass:[NSArray class]]){
        return lists;
    }

    if (data.count > 0) {
       lists = [HLHomeListModel mj_objectArrayWithKeyValuesArray:data];
    }
    
    return lists;
}


@end
